<div class="content-wrapper">
    <?php
    $form = $this->form;
    $form->prepare();
    ?>
    <?php echo $this->form()->openTag($form); ?>
    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>

        <h1 class="pull-right" id="dbshop-menu-top">
            <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-check"></i> <?php echo $this->translate('保存设置'); ?></button>
            <?php echo $this->HelpUrl('emailMessage'); ?>
        </h1>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="nav-tabs-custom">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_1" data-toggle="tab"><?php echo $this->translate('基本设置'); ?></a></li>
                        <li><a href="#tab_2" data-toggle="tab"><?php echo $this->translate('订单提交'); ?></a></li>
                        <li><a href="#tab_3" data-toggle="tab"><?php echo $this->translate('订单付款'); ?></a></li>
                        <li><a href="#tab_4" data-toggle="tab"><?php echo $this->translate('订单发货'); ?></a></li>
                        <li><a href="#tab_5" data-toggle="tab"><?php echo $this->translate('订单收货'); ?></a></li>
                        <li><a href="#tab_6" data-toggle="tab"><?php echo $this->translate('取消订单'); ?></a></li>
                        <li><a href="#tab_7" data-toggle="tab"><?php echo $this->translate('商品缺货'); ?></a></li>
                    </ul>
                    <div class="tab-content">
                        <?php echo $this->partial('layout/messages'); ?>
                        <div class="tab-pane active" id="tab_1">
                            <div class="box-body">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('管理员接收电邮'); ?></label>
                                    <div class="col-sm-5">
                                        <?php echo $this->formElement($form->get('adminEmail')); ?>
                                        <?php echo $this->formElementErrors($form->get('adminEmail'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('管理员接收类型'); ?></label>
                                    <div class="col-sm-10">
                                        <label class="checkbox-inline">
                                            <?php echo $this->formElement($form->get('adminAddOrderSend')); ?> <?php echo $this->translate('订单提交'); ?>
                                            <?php echo $this->formElementErrors($form->get('adminAddOrderSend'), ['class'=>'error-message']); ?>
                                        </label>
                                        <label class="checkbox-inline">
                                            <?php echo $this->formElement($form->get('adminPaymentOrderSend')); ?> <?php echo $this->translate('订单付款'); ?>
                                            <?php echo $this->formElementErrors($form->get('adminPaymentOrderSend'), ['class'=>'error-message']); ?>
                                        </label>
                                        <label class="checkbox-inline">
                                            <?php echo $this->formElement($form->get('adminShipOrderSend')); ?> <?php echo $this->translate('订单发货'); ?>
                                            <?php echo $this->formElementErrors($form->get('adminShipOrderSend'), ['class'=>'error-message']); ?>
                                        </label>
                                        <label class="checkbox-inline">
                                            <?php echo $this->formElement($form->get('adminReceiptOrderSend')); ?> <?php echo $this->translate('订单收货'); ?>
                                            <?php echo $this->formElementErrors($form->get('adminReceiptOrderSend'), ['class'=>'error-message']); ?>
                                        </label>
                                        <label class="checkbox-inline">
                                            <?php echo $this->formElement($form->get('adminCancelOrderSend')); ?> <?php echo $this->translate('取消订单'); ?>
                                            <?php echo $this->formElementErrors($form->get('adminCancelOrderSend'), ['class'=>'error-message']); ?>
                                        </label>
                                        <label class="checkbox-inline">
                                            <?php echo $this->formElement($form->get('adminGoodsStockOutSend')); ?> <?php echo $this->translate('商品缺货'); ?>
                                            <?php echo $this->formElementErrors($form->get('adminGoodsStockOutSend'), ['class'=>'error-message']); ?>
                                        </label>
                                    </div>
                                </div>
                                <hr>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('前台客户接收类型'); ?></label>
                                    <div class="col-sm-10">
                                        <label class="checkbox-inline">
                                            <?php echo $this->formElement($form->get('buyerAddOrderSend')); ?> <?php echo $this->translate('订单提交'); ?>
                                            <?php echo $this->formElementErrors($form->get('buyerAddOrderSend'), ['class'=>'error-message']); ?>
                                        </label>
                                        <label class="checkbox-inline">
                                            <?php echo $this->formElement($form->get('buyerPaymentOrderSend')); ?> <?php echo $this->translate('订单付款'); ?>
                                            <?php echo $this->formElementErrors($form->get('buyerPaymentOrderSend'), ['class'=>'error-message']); ?>
                                        </label>
                                        <label class="checkbox-inline">
                                            <?php echo $this->formElement($form->get('buyerShipOrderSend')); ?> <?php echo $this->translate('订单发货'); ?>
                                            <?php echo $this->formElementErrors($form->get('buyerShipOrderSend'), ['class'=>'error-message']); ?>
                                        </label>
                                        <label class="checkbox-inline">
                                            <?php echo $this->formElement($form->get('buyerReceiptOrderSend')); ?> <?php echo $this->translate('订单收货'); ?>
                                            <?php echo $this->formElementErrors($form->get('buyerReceiptOrderSend'), ['class'=>'error-message']); ?>
                                        </label>
                                        <label class="checkbox-inline">
                                            <?php echo $this->formElement($form->get('buyerCancelOrderSend')); ?> <?php echo $this->translate('订单取消'); ?>
                                            <?php echo $this->formElementErrors($form->get('buyerCancelOrderSend'), ['class'=>'error-message']); ?>
                                        </label>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane" id="tab_2">
                            <div class="box-body">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('消息内容'); ?></label>
                                    <div class="col-sm-10">
                                        <p>
                                            <button type="button" onclick="insertTextareaContent('addOrderEmailBody', '{shopName}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('网站名称'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('addOrderEmailBody', '{buyName}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('买家名称'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('addOrderEmailBody', '{orderSn}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('订单编号'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('addOrderEmailBody', '{orderTotal}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('订单金额'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('addOrderEmailBody', '{addOrderTime}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('订单提交时间'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('addOrderEmailBody', '{shopUrl}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('网站网址'); ?></button>&nbsp;&nbsp;
                                        </p>
                                        <?php echo $this->formElement($form->get('addOrderEmailBody')); ?>
                                        <?php echo $this->formElementErrors($form->get('addOrderEmailBody'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane" id="tab_3">
                            <div class="box-body">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('消息内容'); ?></label>
                                    <div class="col-sm-10">
                                        <p>
                                            <button type="button" onclick="insertTextareaContent('paymentOrderEmailBody', '{shopName}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('网站名称'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('paymentOrderEmailBody', '{buyName}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('买家名称'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('paymentOrderEmailBody', '{orderSn}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('订单编号'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('paymentOrderEmailBody', '{orderTotal}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('订单金额'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('paymentOrderEmailBody', '{paymentOrderTime}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('订单付款时间'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('paymentOrderEmailBody', '{shopUrl}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('网站网址'); ?></button>&nbsp;&nbsp;
                                        </p>
                                        <?php echo $this->formElement($form->get('paymentOrderEmailBody')); ?>
                                        <?php echo $this->formElementErrors($form->get('paymentOrderEmailBody'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane" id="tab_4">
                            <div class="box-body">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('消息内容'); ?></label>
                                    <div class="col-sm-10">
                                        <p>
                                            <button type="button" onclick="insertTextareaContent('shipOrderEmailBody', '{shopName}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('网站名称'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('shipOrderEmailBody', '{buyName}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('买家名称'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('shipOrderEmailBody', '{orderSn}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('订单编号'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('shipOrderEmailBody', '{orderTotal}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('订单金额'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('shipOrderEmailBody', '{deliveryName}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('快递公司'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('shipOrderEmailBody', '{expressNumber}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('快递单号'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('shipOrderEmailBody', '{shipOrderTime}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('订单发货时间'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('shipOrderEmailBody', '{shopUrl}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('网站网址'); ?></button>&nbsp;&nbsp;
                                        </p>
                                        <?php echo $this->formElement($form->get('shipOrderEmailBody')); ?>
                                        <?php echo $this->formElementErrors($form->get('shipOrderEmailBody'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane" id="tab_5">
                            <div class="box-body">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('消息内容'); ?></label>
                                    <div class="col-sm-10">
                                        <p>
                                            <button type="button" onclick="insertTextareaContent('receiptOrderEmailBody', '{shopName}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('网站名称'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('receiptOrderEmailBody', '{buyName}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('买家名称'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('receiptOrderEmailBody', '{orderSn}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('订单编号'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('receiptOrderEmailBody', '{orderTotal}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('订单金额'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('receiptOrderEmailBody', '{deliveryName}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('快递公司'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('receiptOrderEmailBody', '{expressNumber}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('快递单号'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('receiptOrderEmailBody', '{receiptOrderTime}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('订单收货时间'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('receiptOrderEmailBody', '{shopUrl}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('网站网址'); ?></button>&nbsp;&nbsp;
                                        </p>
                                        <?php echo $this->formElement($form->get('receiptOrderEmailBody')); ?>
                                        <?php echo $this->formElementErrors($form->get('receiptOrderEmailBody'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane" id="tab_6">
                            <div class="box-body">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('消息内容'); ?></label>
                                    <div class="col-sm-10">
                                        <p>
                                            <button type="button" onclick="insertTextareaContent('cancelOrderEmailBody', '{shopName}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('网站名称'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('cancelOrderEmailBody', '{buyName}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('买家名称'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('cancelOrderEmailBody', '{orderSn}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('订单编号'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('cancelOrderEmailBody', '{orderTotal}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('订单金额'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('cancelOrderEmailBody', '{cancelOrderTime}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('订单取消时间'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('cancelOrderEmailBody', '{shopUrl}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('网站网址'); ?></button>&nbsp;&nbsp;
                                        </p>
                                        <?php echo $this->formElement($form->get('cancelOrderEmailBody')); ?>
                                        <?php echo $this->formElementErrors($form->get('cancelOrderEmailBody'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="tab-pane" id="tab_7">
                            <div class="box-body">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label"><?php echo $this->translate('消息内容'); ?></label>
                                    <div class="col-sm-10">
                                        <p>
                                            <button type="button" onclick="insertTextareaContent('goodsStockOutBody', '{shopName}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('网站名称'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('goodsStockOutBody', '{goodsName}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('商品名称'); ?></button>&nbsp;&nbsp;
                                            <button type="button" onclick="insertTextareaContent('goodsStockOutBody', '{goodsStock}');" class="btn btn-primary btn-sm"><i class="fa fa-crosshairs"></i> <?php echo $this->translate('当前库存数'); ?></button>&nbsp;&nbsp;
                                        </p>
                                        <?php echo $this->formElement($form->get('goodsStockOutEmailBody')); ?>
                                        <?php echo $this->formElementErrors($form->get('goodsStockOutEmailBody'), ['class'=>'error-message']); ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <?php echo $this->form()->closeTag(); ?>
</div>
<script src="<?php echo $this->basePath('js/plugins/jquerytextbox/jquery.textbox.js'); ?>"></script>
<script>
    function insertTextareaContent(inputId, insertBody) {
        $("#"+inputId).textbox().insertText(insertBody);
    }
</script>